home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
os2
/
cfspoker.zip
/
CFSPoker.PKG
/
CFSGames.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-05-09
|
17KB
|
490 lines
/*------------------------------------------------------------------------*\
| |
| CFSGames.CMD - Version 1.0 - Version Date 1995-04-15 |
| Copyright (C) 1995-96 by C F S Nevada, Inc. |
| |
| by Dick Goran - Voice 702-732-9616 |
| - FAX 702-732-3847 |
| - CIS 71154,2002 |
| - Internet dgoran@cfsrexx.com |
| - WWW <http://www.cfsrexx.com> |
| |
\*------------------------------------------------------------------------*/
/*
This program is distributed as part of CFSPoker. Its function is to
provide maintenance to the CFSPoker INI file by replacing / adding
game characteristics. If any errors are encountered, the INI file
is not changed and the appropriate error code (shown below) is
returned to the calling program.
Detailed instructions for the structure of the CFSPoker.GAM file
is contained in the CFSPoker.INF file under the heading of
"CFSPoker.GAM file".
Calling parameters:
-------------------
The name of the CFSPoker INI file to receive the maintenance. If not
specified, CFSPoker.INI in the current directory will be used.
Returns:
--------
-4 Unexpected error writing to INI file
-3 Unexpected error building array of old game names.
-2 Unexpected error retieving game names from existing INI
file. This indicates that the INI file is corrupted.
-1 Unable to locate CFSPoker.GAM file (game characteristics)
0 Unable to locate INI file
nn The number of game entries in the INI file
*/
GBL. = '' /* initialize stem */
parse Arg GBL.command_line
parse Version GBL.REXX_version,
GBL.REXX_version_level,
GBL.REXX_version_day,
GBL.REXX_version_month,
GBL.REXX_version_year .
parse upper Source GBL.operating_system,
GBL.calling_environment,
GBL.program_path_and_name
GBL.environment = 'OS2ENVIRONMENT'
GBL.boot_drive = LEFT( VALUE( 'RUNWORKPLACE',, GBL.environment ), 2 )
GBL.program_version = 1.0 /* version / mod of this program */
GBL.program_name = STRIP( FILESPEC( 'N', GBL.program_path_and_name ) )
GBL.program_path = STRIP( FILESPEC( 'D', GBL.program_path_and_name ) ||,
FILESPEC( 'P', GBL.program_path_and_name ) )
parse var GBL.program_name,
GBL.program_fn '.',
GBL.program_fe
/*------------------------*\
| Enable trap processing |
\*------------------------*/
SIGNAL ON ERROR
SIGNAL ON FAILURE
SIGNAL ON HALT
SIGNAL ON NOVALUE
SIGNAL ON SYNTAX
call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
call SysLoadFuncs
/*----------------------*\
| Variable definitions |
\*----------------------*/
GBL.error_counter = 0 /* general error counter */
GBL.error_file =,
GBL.program_path ||,
'CFSGames.ERR'
GBL.list =,
'input_line',
'input_line_number',
''
/*----------------------------*\
| Erase any prior error file |
\*----------------------------*/
call SysFileDelete GBL.error_file /* delete if first error */
/*---------------------------------*\
| Assure valid INI file available |
\*---------------------------------*/
CHECK_FOR_INI_FILE:
if GBL.command_line ¬= '' then
do
GBL.INI_File =,
STREAM( GBL.command_line, 'C', 'QUERY EXISTS' )
end
else
do
GBL.INI_File =,
STREAM( 'CFSPoker.INI', 'C', 'QUERY EXISTS' )
end
if GBL.INI_file = '' then
do
call EOJ 0
end
GBL.ini_path =,
FILESPEC( 'D', GBL.INI_file ) ||,
FILESPEC( 'P', GBL.INI_file ) ||,
''
/*------------------------------------*\
| Test for presence of CFSPoker.GAM |
| file in same directory as INI file |
\*------------------------------------*/
CHECK_FOR_GAM_FILE:
GBL.GAM_file =,
STREAM( GBL.INI_path || 'CFSPoker.GAM', 'C', 'QUERY EXISTS' )
if GBL.GAM_file = '' then
do
call EOJ -1
end
/*------------------------------------*\
| Process .GAM file entries building |
| array from all valid lines |
\*------------------------------------*/
READ_AND_PROCESS_GAM_FILE:
new_game_table.0 = 0
input_line_number = 0
do while LINES( GBL.GAM_file ) > 0
input_line = LINEIN( GBL.GAM_file )
input_line_number = input_line_number + 1
/*----------------------------*\
| Ignore insignificant lines |
\*----------------------------*/
if input_line = '' then iterate
first_character_of_input_line = LEFT( input_line, 1 )
if first_character_of_input_line = ' ',
|,
first_character_of_input_line = '*' then iterate
/*-------------------------*\
| Check for new game name |
\*-------------------------*/
if first_character_of_input_line = '[' then
do
parse value input_line with,
'[',
game_name,
']'
if game_name = '' then
do
call INPUT_ERROR_ROUTINE '001 Missing game name'
GBL.ignore_detail_lines_switch = input_line_number
iterate
end
uppercase_game_name = TRANSLATE( game_name )
if uppercase_game_name = 'WILD',
|,
uppercase_game_name = 'COUNTERS' then
do
call INPUT_ERROR_ROUTINE '002 Invalid game name'
GBL.ignore_detail_lines_switch = input_line_number
iterate
end
GBL.ignore_detail_lines_switch = ''
n = new_game_table.0 + 1
new_game_table.0 = n
new_game_table.n = game_name
new_game_table.n.0 = 0
iterate
end
/*----------------------------------------*\
| Ignore detail lines if game name is NG |
\*----------------------------------------*/
if GBL.ignore_detail_lines_switch ¬= '' then
do
call INPUT_ERROR_ROUTINE '003 Ignored because of previous error'
iterate
end
/*--------------------------*\
| Process game detail line |
\*--------------------------*/
line_error_counter = 0
parse value input_line with,
hand_title ';',
hand_abbreviation ';',
one_coin_payoff ';',
five_coin_payoff ';'
hand_title = STRIP( hand_title )
hand_abbreviation = TRANSLATE( STRIP( hand_abbreviation ) )
one_coin_payoff = STRIP( one_coin_payoff )
five_coin_payoff = STRIP( five_coin_payoff )
if TRANSLATE( hand_title ) = 'WILD' then
do
line = new_game_table.n.0 + 1
new_game_table.n.0 = line
new_game_table.n.line = 'WILD' hand_abbreviation
iterate
end
if DATATYPE( one_coin_payoff ) ¬= 'NUM' then
do
line_error_counter = line_error_counter + 1
end
else
if five_coin_payoff = '' then
do
five_coin_payoff = one_coin_payoff * 5
end
if DATATYPE( five_coin_payoff ) ¬= 'NUM' then
do
line_error_counter = line_error_counter + 1
end
if line_error_counter > 0 then
do
call INPUT_ERROR_ROUTINE '004 [' || game_name || ']',
'Error on game characteristic line. ',
'Source line =' RIGHT( input_line_number, 3 )
GBL.error_counter = GBL.error_counter + 1
iterate
end
line = new_game_table.n.0 + 1
new_game_table.n.0 =